package mrh.niubi.librarysystem.service.impl;

import mrh.niubi.librarysystem.mapper.BookMapper;
import mrh.niubi.librarysystem.pojo.Book;
import mrh.niubi.librarysystem.pojo.Borrower;
import mrh.niubi.librarysystem.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Resource
    private BookMapper bookMapper;

    @Override
    public List<Book> selectBooksByQueryinf(String queryinf) {
        return bookMapper.selectBooksByQueryinf(queryinf);
    }

    @Override
    public int delBookById(String id) {
        return bookMapper.deleteById(id);
    }

    @Override
    public int addBook(Book book) {
        return bookMapper.insert(book);
    }

    @Override
    public int editBook(Book book) {
        return bookMapper.updateById(book);
    }

    @Override
    public Book selectBookById(int id) {
        return bookMapper.selectById(id);
    }

    @Override
    public int subNum(Integer id, Long num) {
        return bookMapper.subNum(id,num);
    }

    @Override
    public int addNum(Integer id, Long num) {
        return bookMapper.addNum(id,num);
    }
}
